package com.sws.orderMS.command;

import com.sws.orderMS.pojo.User;

public abstract class CommandFactory {

	public static enum CommandCode {
		// System
		EXIT,
		HELP,
		LOGIN,
		SIGNUP,
		
		// client
		MODIFY,			// 修改个人信息
		RECHARGE,		// 充值
		LIST_PRODUCT,	// 查看商品
		ORDER,			// 订购商品，生成订单
		PAY,			// 付款
		LIST_MY_ORDER,	// 查看我的订单
		
		// Manager
		USER_MANAGE,	// 用户管理
		PRODUCT_MANAGE,	// 商品管理
		ORDER_MANAGE,	// 订单管理
		
	}
	
	public static CommandFactory buildFactory(User user) {
		if (user == null) {
			return new SystemCommandFactory();
		} else {
			return new UserCommandFactory(user);
		}
	}
	
	public abstract Command buildCommand(CommandCode cmd);
}
